package com.ArrayListTest;

import java.util.ArrayList;

public class test4 {

    public static void main(String[] args) {
        int mile = 100;
        double price = 1000000.0;
        Car car1 = new Car("宝马",120,1200000.7);
        Car car2 = new Car("奔驰",90,900000.7);
        Car car3 = new Car("路虎",120,200000.7);
        ArrayList<Car> carArrayList = new ArrayList<Car>();
        carArrayList.add(car1);
        carArrayList.add(car2);
        carArrayList.add(car3);
        show(carArrayList,mile,price);
    }
    public static void show(ArrayList<Car> list,int mile,double price){
        for (int i=0;i<list.size();i++){
            if (list.get(i).getMile()>mile&&list.get(i).getPrice()<price){
                System.out.println(list.get(i).getBrand());
            }
        }
    }
}
